import json

from db import operator
from db import datasource
from doc import doc

host = "127.0.0.1"
port = 0
database = ""
username = ""
password = ""

if __name__ == '__main__':
    # 读取配置文件，选择合适的数据库操作库
    with open('config.json', 'r', encoding='utf8') as fp:
        config = json.load(fp)
    datasource = datasource.Datasource()
    doc = doc.Doc()
    datasource.__dict__ = config['db']
    doc.__dict__ = config['doc']
    # 读取数据库设计文档 by sql
    data, col = operator.Operator.execute(ds=datasource)
    doc.export(datasource, data, col)
